package com.chennan.javabase.domain.datacuncu;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.PriorityQueue;

/**
 * @author chennan
 * @create 2021-11
 *
 * 优先队列的使用
 */
public class PriorityQueueTest {
    public static void main(String[] args) {
        new PriorityQueueTest().test1();
    }

    public void test1() {
        PriorityQueue<String> strings = new PriorityQueue<>();

        for (int i = 0; i < 10; i++) {
            strings.offer(String.valueOf(i));
        }
        int size = strings.size();
        System.out.println(size);
        for (int i = 0; i < size; i++) {
            System.out.println(strings.remove());
        }
    }
}
